import { defineView } from "@/routers/tools.mjs";

// via https://docs.angularjs.org/api/ng/directive/ngRef
/**
 * @type {DefineView}
 */
const NgRefInsideView = defineView({
  /**
   * @implements {ng.IController}
   */
  controller: class NgRefInsideViewCtrl {
    static $inject = ["$scope"];

    /**
     * @param {ng.IScope} $scope
     */
    constructor($scope) {
      this.$scope = $scope;
    }

    $onInit() {
      return import("./ng-ref-inside.css");
    }

    handleClick() {
      console.log("NgRefInsideViewCtrl", this);
    }
  },
  controllerAs: "$view_ctrl",
  template: /* HTML */ html`
    <nfi-root ng-ref="nfiRoot"></nfi-root>
    ${DebugButtonHTML("$view_ctrl")}
  `,
});
// console.log(11);
if (import.meta.webpackHot) {
  console.log("import.meta.webpackHot", import.meta.webpackHot);
  import.meta.webpackHot.accept("./ng-ref-inside.css", () => {
    console.log("Hot accept ./ng-ref-inside.css");
  });
}

export default NgRefInsideView;
